# usbutils
# Builds from https://github.com/puppylinux-woof-CE/petbuilds

. ../func
. ../build.conf

URL=https://www.kernel.org/pub/linux/utils/usb/usbutils
PKG=usbutils
VER=007
COMP=tar.xz
DESC="utilities for identifying usb devices"
DEPS=
CAT=BuildingBlock
DESKTOP=usbutils.desktop
BUILD=
CWD=$(pwd)
[ -z "$MWD" ] && MWD=$(dirname $CWD)	
[ -z "$BUILD" ] && BUILD=$DEF_BUILD
#[ -f "$DESKTOP" ] || DESKTOP=not
#[ -z "$DEPS" ] && DEPS=not	

ARCH=$(uname -m)
case $ARCH in
 *64) 	LIBDIR=$LIBCONF64 ;;
 arm*)	LIBDIR=$LIBCONFarm;;
 *) 	LIBDIR=$LIBCONF32 ;;
esac

build() {
	cd ${PKG}-${VER}
	./configure --prefix=/usr \
				--localstatedir=/var \
				--sysconfdir=/etc \
				--libdir=/usr/${LIBDIR} \
				--disable-zlib
	[ "$?" -eq 0 ] || exit
	make $MKFLG
	[ "$?" -eq 0 ] || exit
	make DESTDIR=$CWD/${PKG}-install install
	cd -
}
	
package() {
	# SPECIAL try and choot into package and run update-usbids
	(cd ./${PKG}-install/usr/share; rm usb.ids; wget -c http://www.linux-usb.org/usb.ids)
}

# main
retrieve "${PKG}-${VER}.${COMP} --no-check-certificate"
extract ${PKG}-${VER}.${COMP}
build
package	
package_std $PKG $VER $ARCH $DESKTOP "$DESC" $DEPS $CAT
